####################################################################################
## 比较吸烟、饮酒、HP感染是否会对IGC和DGC的分子亚型产生影响
${Rscript} ${scripts_path}/revise/molecular_subtype_baseinfo.R \
--info_file ${work_dir}/public_ref/combine/MutationInfo.combine.addMolecularSubType.rmMIX.tsv \
--out_path ${work_dir}/finalPlot/revise/molecular_type/baseinfo

####################################################################################
## Maintained的基因的Trunk以及Private突变，拷贝数的改变是否相似，其bialleic的差异
${Rscript} ${scripts_path}/revise/JudgeGeneDriverDoubleHit.R \
--ccf_file ${MutationTime_path}/result/All_CCF_mutTime.addShare.rmMIX.tsv \
--sample_info ${config_path}/tumor_normal.class.list \
--out_path ${work_dir}/finalPlot/revise/maintained

## TP53突变的Trunk以及Private突变类型
${Rscript} ${scripts_path}/revise/JudgeGeneDriverMutType.R \
--ccf_file ${MutationTime_path}/result/All_CCF_mutTime.addShare.rmMIX.tsv \
--sample_info ${config_path}/tumor_normal.class.list \
--out_path ${work_dir}/finalPlot/revise/maintained

####################################################################################
## TP53的Trunk突变和Private突变的表达差异
mut_type_list=(all missense lof)
gene=TP53
for mut_type in ${mut_type_list[@]}
do
${Rscript} ${scripts_path}/revise/showGene.Normalize.TrunkvsPrivate.R \
--sample_list_file ${config_path}/tumor_normal.class.list \
--mut_file ${MutationTime_path}/result/All_CCF_mutTime.addShare.rmMIX.tsv \
--mut_type ${mut_type} \
--rsem_file ${mRNA_path}/CombineTMM.DNAUse.NJMU_TCGA.tsv \
--out_path ${work_dir}/finalPlot/revise/maintained/expression \
--gene ${gene}
done

## TP53的LOH突变、非LOH突变及野生型的差异
${Rscript} ${scripts_path}/revise/showGene.Normalize.LOHvsNonLOH.R \
--sample_list_file ${config_path}/tumor_normal.class.list \
--mut_file ${MutationTime_path}/result/All_CCF_mutTime.addShare.rmMIX.tsv \
--rsem_file ${mRNA_path}/CombineTMM.DNAUse.NJMU_TCGA.tsv \
--out_path ${work_dir}/finalPlot/revise/maintained/expression \
--gene ${gene}

##########################################
## 提取CDKN2A的拷贝数信息，判断是否发生LOH
gene=CDKN2A
mkdir -p ${work_dir}/finalPlot/revise/${gene}
cat ~/ref/GTF/gencode.v19.annotation.gtf | grep -w ${gene} | grep -w gene | awk '{OFS="\t"}{print $1,$4,$5}' | sed 's/chr//' \
> ${work_dir}/finalPlot/revise/${gene}/${gene}.bed
## 提取拷贝数(NJMU)
cat ${Titan_path}/Titan_all_seg.final.tsv | awk -F'\t' '{OFS="\t"}{print $2,$3,$4,$1,$20,$22,$23}' | sed '1d' |\
${bedtools} sort -i - > ${work_dir}/finalPlot/revise/${gene}/cnv.njmu.bed
## 提取覆盖基因的拷贝数(TCGA)
cat ${work_dir}/seg_public/TCGA_use.absolute.seg | awk -F'\t' '{OFS="\t"}{print $2,$3,$4,$1,$6,$7,$8}' | sed '1d' | sed 's/[.]0//g' |\
${bedtools} sort -i - > ${work_dir}/finalPlot/revise/${gene}/cnv.tcga.bed
## 合并
cat ${work_dir}/finalPlot/revise/${gene}/cnv.njmu.bed ${work_dir}/finalPlot/revise/${gene}/cnv.tcga.bed |\
${bedtools} sort -i - > ${work_dir}/finalPlot/revise/${gene}/cnv.bed
## 注释区域
cat ${Titan_path}/Titan_all_seg.final.tsv | awk -F'\t' '{OFS="\t"}{print $2,$3,$4,$1,$20,$22,$23}' | \
head -1 > ${work_dir}/finalPlot/revise/${gene}/${gene}.cnv.bed
${bedtools} intersect -wa -a ${work_dir}/finalPlot/revise/${gene}/cnv.bed -b ${work_dir}/finalPlot/revise/${gene}/${gene}.bed \
>> ${work_dir}/finalPlot/revise/${gene}/${gene}.cnv.bed

## 可视化
${Rscript} ${scripts_path}/revise/JudgeGeneDriverLOH.R \
--cnv_file ${work_dir}/finalPlot/revise/${gene}/${gene}.cnv.bed \
--njmu_info ${work_dir}/baseTable/STAD_Info.addBurden.MSI_MSS.addCNVType.rmMIX.tsv \
--public_info ${work_dir}/public_ref/combine/MutationInfo.combine.addMolecularSubType.rmMIX.tsv \
--out_path ${work_dir}/finalPlot/revise/${gene}

##########################################
## 提取TP53的拷贝数信息，判断是否发生双等位失活
gene=TP53
mkdir -p ${work_dir}/finalPlot/revise/${gene}
cat ~/ref/GTF/gencode.v19.annotation.gtf | grep -w ${gene} | grep -w gene | awk '{OFS="\t"}{print $1,$4,$5}' | sed 's/chr//' \
> ${work_dir}/finalPlot/revise/${gene}/${gene}.bed
## 提取拷贝数(NJMU)
cat ${Titan_path}/Titan_all_seg.final.tsv | awk -F'\t' '{OFS="\t"}{print $2,$3,$4,$1,$20,$22,$23}' | sed '1d' |\
${bedtools} sort -i - > ${work_dir}/finalPlot/revise/${gene}/cnv.njmu.bed
## 提取覆盖基因的拷贝数(TCGA)
cat ${work_dir}/seg_public/TCGA_use.absolute.seg | awk -F'\t' '{OFS="\t"}{print $2,$3,$4,$1,$6,$7,$8}' | sed '1d' | sed 's/[.]0//g' |\
${bedtools} sort -i - > ${work_dir}/finalPlot/revise/${gene}/cnv.tcga.bed
## 合并
cat ${work_dir}/finalPlot/revise/${gene}/cnv.njmu.bed ${work_dir}/finalPlot/revise/${gene}/cnv.tcga.bed |\
${bedtools} sort -i - > ${work_dir}/finalPlot/revise/${gene}/cnv.bed
## 注释区域
cat ${Titan_path}/Titan_all_seg.final.tsv | awk -F'\t' '{OFS="\t"}{print $2,$3,$4,$1,$20,$22,$23}' | \
head -1 > ${work_dir}/finalPlot/revise/${gene}/${gene}.cnv.bed
${bedtools} intersect -wa -a ${work_dir}/finalPlot/revise/${gene}/cnv.bed -b ${work_dir}/finalPlot/revise/${gene}/${gene}.bed \
>> ${work_dir}/finalPlot/revise/${gene}/${gene}.cnv.bed

## 可视化
${Rscript} ${scripts_path}/revise/JudgeGeneDriverBiallelic.R \
--cnv_file ${work_dir}/finalPlot/revise/${gene}/${gene}.cnv.bed \
--njmu_info ${work_dir}/baseTable/STAD_Info.addBurden.MSI_MSS.addCNVType.rmMIX.tsv \
--public_info ${work_dir}/public_ref/combine/MutationInfo.combine.addMolecularSubType.rmMIX.tsv \
--igc_maf_file ${work_dir}/maf_public/All_use.IGC.maf \
--dgc_maf_file ${work_dir}/maf_public/All_use.DGC.maf \
--out_path ${work_dir}/finalPlot/revise/${gene}

##########################################
## 饮酒对IM favored基因突变率的影响
${Rscript} ${scripts_path}/revise/mutRate_plot.Alcohol.R \
--mut_rate_gene_file ${work_dir}/finalPlot/SMG_Waterfull/mutRate_forbaseline/MutRate_baline_Alcohol.tsv \
--images_path ${work_dir}/finalPlot/revise/im_favored

## 分子亚型对IM favored基因突变率的影响
# 突变率计算
${Rscript} ${scripts_path}/revise/mutRate_compute.molType.IM.R \
--maf_im_msi_file ${maf_public_path}/All_use.IM.msi.maf \
--maf_im_file ${maf_public_path}/All_use.IM.maf \
--info_file ${work_dir}/baseTable/STAD_Info.addBurden.MSI_MSS.addCNVType.rmMIX.tsv \
--images_path ${work_dir}/finalPlot/revise/im_favored 
# 画图
gene_list=( MUC6 CFTR BMP6 MTRR )
for gene in ${gene_list[@]}
do
${Rscript} ${scripts_path}/revise/mutRate_compute.molType.IM.plot.R \
--gene ${gene} \
--mut_rate_gene_file ${work_dir}/finalPlot/revise/im_favored/MutRate.molType.IM.tsv \
--images_path ${work_dir}/finalPlot/revise/im_favored  
done

##########################################
# 饮酒对MUC6 recurrent 和 非 recurrent突变率的影响
${Rscript} ${scripts_path}/revise/mutRate_plot.Alcohol.MUC6.R \
--ccf_file ${MutationTime_path}/result/All_CCF_mutTime.addShare.rmMIX.tsv \
--info_file ${work_dir}/baseTable/STAD_Info.addBurden.MSI_MSS.addCNVType.tsv \
--images_path ${work_dir}/finalPlot/revise/im_favored

####################################################################################
## 时间比较
## 1、IM进展为IGC的时间，IM进展为DGC的时间，对应的Figure 6a, Supplyment Fig11
## CompareIGC_DGC.Time.pdf
## 2、发生Maintained的TP53、APC、CDH1、PIK3CA基因突变是否会加速IM进展为胃癌的时间，分层all、IGC和DGC，对应的Figure6的b图
## CompareTrunkSMG.Time.All.pdf
## CompareTrunkSMG.Time.IGC.pdf
## CompareTrunkSMG.Time.DGC.pdf
## 2、发生Maintained的TP53、APC、CDH1、PIK3CA基因突变其进展时间的95%可信区间，分层IGC和DGC，对应的Figure6的c图
## CompareTrunkSMG.Time.DGC.95CI.pdf
## CompareTrunkSMG.Time.IGC.95CI.pdf
# 增加 饮酒/非饮酒/GS亚型和CIN亚型中，进展时间的分别比较
type_list=(All Drink No GS CIN)
for type in ${type_list[@]}
do
${Rscript} ${scripts_path}/evolutionTime/compareTime.R \
--ccf_file ${MutationTime_path}/result/All_CCF_mutTime.addShare.tsv \
--type ${type} \
--gene_list ${mutsig_check_path}/maintained_smg.list  \
--sample_info ${config_path}/tumor_normal.class.list \
--input_file ${work_dir}/finalPlot/evolutionTime/timing_molecular_clock.tsv \
--base_info_file ${work_dir}/baseTable/STAD_Info.addBurden.MSI_MSS.addCNVType.tsv \
--out_path ${work_dir}/finalPlot/revise/evolutionTime/${type}
done

## 比较GS和CIN亚型的进展时间差异，在IGC和DGC，TrunkDriver和Other，drink和nondrink中分别比较
${Rscript} ${scripts_path}/revise/compareTime.molType.R \
--ccf_file ${MutationTime_path}/result/All_CCF_mutTime.addShare.tsv \
--gene_list ${mutsig_check_path}/maintained_smg.list  \
--sample_info ${config_path}/tumor_normal.class.list \
--input_file ${work_dir}/finalPlot/evolutionTime/timing_molecular_clock.tsv \
--base_info_file ${work_dir}/baseTable/STAD_Info.addBurden.MSI_MSS.addCNVType.tsv \
--out_path ${work_dir}/finalPlot/revise/evolutionTime

## 比较饮酒和非饮酒患者的进展时间差异，在IGC和DGC，TrunkDriver和Other中分别比较
${Rscript} ${scripts_path}/revise/compareTime.drink.R \
--ccf_file ${MutationTime_path}/result/All_CCF_mutTime.addShare.tsv \
--gene_list ${mutsig_check_path}/maintained_smg.list  \
--sample_info ${config_path}/tumor_normal.class.list \
--input_file ${work_dir}/finalPlot/evolutionTime/timing_molecular_clock.tsv \
--base_info_file ${work_dir}/baseTable/STAD_Info.addBurden.MSI_MSS.addCNVType.tsv \
--out_path ${work_dir}/finalPlot/revise/evolutionTime

####################################################################################
### IM和Normal、IGC和Normal、DGC和Normal的差异基因可视化
export foldchange_t=1.5
export q_t=0.05

##下面针对各亚型，在IGC和DGC中差异表达，可视化热图和通路富集
for subtype in `echo -e "All\nCIN\nGS\nMSI"`
do
echo ${subtype}
${Rscript_clusterProfiler} ${scripts_path}/revise/diffGene_compute_match_IM_IGC_DGC.R \
--sample_list_file ${work_dir}/public_ref/combine/MutationInfo.combine.addMolecularSubType.rmMIX.tsv  \
--gtf_file ${ref_path}/GTF/gencode.v19.ensg_genename.txt \
--rsem_file ${work_dir}/finalPlot/mrna/DiffGene/CombineCounts.FilterLowExpression-MergeMutiSample.TMM.tsv \
--foldchange_t ${foldchange_t} \
--q_t ${q_t} \
--subtype ${subtype} \
--out_path ${work_dir}/finalPlot/revise/mrna/DiffGene/${subtype} 
done

####################################################################################
## 描述"TP53" , "CDH1" , "APC" , "RHOA" , "KRAS"驱动基因在不同研究中的IGC和DGC的突变率是否存在差异
# Ancillary Figure 1
from_type=("NJMU" "TCGA" "OncoSG" "TMUCIH")
for from in ${from_type[@]}
do
${Rscript} ${scripts_path}/revise/mutRate_plot.IGC_DGC.R \
--smg_file ${mutsig_check_path}/smg.list \
--mut_rate_gene_file ${Images_path}/mutRate/MutRate.tsv \
--from ${from} \
--images_path ${work_dir}/finalPlot/revise/smgs
done

## IGC和DGC不同分子亚型比较突变率,CDH1单独画一张图
# Ancillary Figure 2
class_type=("IGC" "DGC")
for classN in ${class_type[@]}
do
${Rscript} ${scripts_path}/revise/mutRate_plot.IGC_DGC.molType.R \
--smg_file ${mutsig_check_path}/smg.list \
--mut_rate_gene_file ${Images_path}/mutRate/MutRate.molType.tsv \
--classN ${classN} \
--images_path ${work_dir}/finalPlot/revise/smgs
done

## 不同分子亚型比较IGC和DGC的突变率,展示TP53的
${Rscript} ${scripts_path}/revise/mutRate_plot.molType.IGC_DGC.R \
--smg_file ${mutsig_check_path}/smg.list \
--mut_rate_gene_file ${Images_path}/mutRate/MutRate.molType.tsv \
--images_path ${work_dir}/finalPlot/revise/smgs
## IGC和DGC的突变负荷在不同分子亚型中比较，在TP53突变和野生中分别比较
geneNlist=(TP53 CDH1)
for geneN in ${geneNlist[@]}
do
${Rscript} ${scripts_path}/revise/mutBurden.MolecularType.usegene.R \
--input_file ${work_dir}/public_ref/combine/MutationInfo.combine.addMolecularSubType.tsv \
--maf_file ${work_dir}/maf_public/All_use.maf \
--geneN ${geneN} \
--out_path ${work_dir}/finalPlot/revise/smgs
done

## HP感染对显著突变基因突变率的影响
${Rscript} ${scripts_path}/finalPlot/mutRate_plot.HP.R \
--mut_rate_gene_file ${work_dir}/finalPlot/SMG_Waterfull/mutRate_forbaseline/MutRate_baline_HP.tsv \
--smg_file ${mutsig_check_path}/All_driver.list \
--images_path ${work_dir}/finalPlot/revise/smgs

## 分IM、IGC和DGC分别计算dn/ds
${Rscript_singlecell} ${scripts_path}/revise/smg_dnds.R \
--info_file ${work_dir}/public_ref/combine/MutationInfo.combine.addMolecularSubType.rmMIX.tsv \
--input_im_file ${maf_public_path}/All_use.IM.maf \
--input_igc_file ${maf_public_path}/All_use.IGC.maf \
--input_dgc_file ${maf_public_path}/All_use.DGC.maf \
--out_path ${work_dir}/finalPlot/revise/smgs
# 可视化20个基因的dn/ds的ratio
${Rscript} ${scripts_path}/revise/smg_dnds_plot.R \
--input_file ${work_dir}/finalPlot/revise/smgs/compute_dn_ds.csv \
--smg_file ${mutsig_check_path}/smg.list \
--out_path ${work_dir}/finalPlot/revise/smgs
# 提取smg基因的突变选择情况
cat ${work_dir}/finalPlot/revise/smgs/compute_dn_ds.csv | head -1 \
> ${work_dir}/finalPlot/revise/smgs/compute_dn_ds.smg.csv
cat ${work_dir}/finalPlot/revise/smgs/compute_dn_ds.csv | \
grep -w -f ${mutsig_check_path}/smg.list | grep -v .p \
>> ${work_dir}/finalPlot/revise/smgs/compute_dn_ds.smg.csv



## 按照年龄、吸烟、饮酒、HP感染对演化模式进行分层
clone_t=0.6
class_type_list=("IGC" "DGC")
base_type_list=("Drink_Drinker" "Drink_Nondrinker" "HP_Postive" "HP_Negative" "Smoke_smoker" "Smoke_nonsmoker" "Age_Older" "Age_Younger")
for class_type in ${class_type_list[@]}
do
for base_type in ${base_type_list[@]}
do
## 驱动基因的共享和私有情况
${Rscript} ${scripts_path}/revise/divide_JudgeGeneDriverSharePrivate.R \
--muti_cancer ${maf_path}/All_GGA.cancer.maf \
--muti_pre ${maf_path}/All_GGA.precancer.maf \
--ccf_file ${MutationTime_path}/result/All_CCF_mutTime.tsv \
--gene_list ${mutsig_check_path}/smg.list  \
--sample_info ${work_dir}/baseTable/STAD_Info.addBurden.MSI_MSS.addCNVType.rmMIX.tsv \
--type ${class_type} \
--base_type ${base_type} \
--clone_t ${clone_t} \
--out_path ${work_dir}/finalPlot/revise/smgs/mode_baseline_divide
done
done
# 将基因画在一张图上，按照进化模式及基线类型比较，说明模式的稳健性
class_type_list=("GC" "IGC" "DGC")
base_type_list=("Drink" "HP" "Smoke" "Age")
for class_type in ${class_type_list[@]}
do
for base_type in ${base_type_list[@]}
do
${Rscript} ${scripts_path}/revise/divide_JudgeGeneDriverSharePrivatePlot.R \
--input_path ${work_dir}/finalPlot/revise/smgs/mode_baseline_divide \
--type ${class_type} \
--base_type ${base_type} \
--out_path ${work_dir}/finalPlot/revise/smgs/mode_baseline_divide_plot
done
done


####################################################################################
## GKN1和GKN2的染色图
## MUC6突变样本整体Pit细胞其它三个IM样本的Pit细胞，GKN1和GKN2表达是否存在差异
## Scissor阳性的Pit细胞和所有其它Pit（包含阴性和三个IM的样本），
${Rscript_singlecell} ${scripts_path}/singlecell/differexpression.MUC6.diffsample.R \
--single_cell_file ${work_dir}/finalPlot/MUC6_BMP6_CFTR/scissor/Scissor_STAD_MUC6_mutation.IM.CellRate.all.RData \
--single_cell_all_file ${work_dir}/public_ref/singleCell/njmu/epiall_nor_PCA_50_RE0.5.Rdata \
--singleCell_sample_file ${config_path}/singleCell_Sample.useThree.list \
--gene MUC6 \
--cds_file ~/ref/PCAWG_Elements/web_hg19/gc19_pc.cds.use.bed \
--pathway_path ~/ref/Pathway/ \
--out_path ${work_dir}/finalPlot/revise/im_favored/Diff_CompareThreeWild

## MUC6突变样本整体Pit细胞其它三个IM样本的所有基因的差异表达
## 比较MUC6表达在其中的差异
${Rscript_singlecell} ${scripts_path}/singlecell/differexpression.MUC6.diffsample.allcell.R \
--single_cell_all_file ${work_dir}/public_ref/singleCell/njmu/epiall_nor_PCA_50_RE0.5.Rdata \
--singleCell_sample_file ${config_path}/singleCell_Sample.useThree.list \
--gene MUC6 \
--cds_file ~/ref/PCAWG_Elements/web_hg19/gc19_pc.cds.use.bed \
--pathway_path ~/ref/Pathway/ \
--out_path ${work_dir}/finalPlot/revise/im_favored/Diff_CompareThreeWild

## umap图，染色GKN1和GKN2，提醒GKN1和GKN2特异在MUC6突变Pit细胞表达
gene_list=( GKN1 GKN2 )
for gene in ${gene_list[@]}
do
${Rscript_singlecell} ${scripts_path}/singlecell/showGene.vln.MUC6.R \
--single_cell_file ${Images_path}/singleCell_MUC6/Scissor_STAD_MUC6_mutation.IM.CellRate.all.RData \
--gene ${gene} \
--out_path ${work_dir}/finalPlot/revise/im_favored
done

## 差异表达基因进行通路富集
${Rscript_clusterProfiler} ${scripts_path}/singlecell/differexpression.MUC6.plot.R \
--input_file ${work_dir}/finalPlot/MUC6_BMP6_CFTR/Diff/DiffGene.Pit.tsv \
--gene MUC6 \
--out_path ${work_dir}/finalPlot/MUC6_BMP6_CFTR/Diff

## MUC6突变样本及野生样本比较免疫细胞占比
${Rscript_singlecell} ${scripts_path}/revise/immuneCell_compare.R \
--singleCell_sample_file ${config_path}/singleCell_Sample.useThree.list \
--single_cell_file ${work_dir}/public_ref/singleCell/njmu/ALL_SIN_celltype.Rdata \
--out_path ${work_dir}/finalPlot/revise/im_favored

## 提取用到样本的免疫细胞
${Rscript_cpbd} ${scripts_path}/revise/imuneCell_cellphonedb.R \
--single_cell_scissor_file ${Images_path}/singleCell_MUC6/Scissor_STAD_MUC6_mutation.IM.CellRate.all.RData \
--single_cell_all_file ${work_dir}/public_ref/singleCell/njmu/ALL_SIN_celltype.Rdata \
--out_path ${work_dir}/finalPlot/revise/im_favored/immuneCell_cpdb
## 运行cellphonedb
${python_cpbd} ${scripts_path}/revise/imuneCell_cellphonedb.py
## 可视化
${Rscript_cpbd} ${scripts_path}/revise/imuneCell_cellphonedb_ktplots.R \
--pvals_file ${work_dir}/finalPlot/revise/im_favored/immuneCell_cpdb/statistical_analysis_pvalues_IM_MUC6.txt \
--means_file ${work_dir}/finalPlot/revise/im_favored/immuneCell_cpdb/statistical_analysis_means_IM_MUC6.txt \
--out_path ${work_dir}/finalPlot/revise/im_favored/immuneCell_cpdb
## 免疫细胞染色
${Rscript_singlecell} ${scripts_path}/revise/imuneCell_markergene_umap.R \
--singleCell_sample_file ${config_path}/singleCell_Sample.useThree.list \
--single_cell_file ${work_dir}/public_ref/singleCell/njmu/ALL_SIN_celltype.Rdata \
--out_path ${work_dir}/finalPlot/revise/im_favored


####################################################################################
## 描述突变负荷和年龄的相关
# 突变负荷和年龄的线性关系
${Rscript_clusterProfiler} ${scripts_path}/revise/age_tmb.R \
--input_file ${work_dir}/public_ref/combine/MutationInfo.combine.addMolecularSubType.rmMIX.tsv \
--njmu_file ${work_dir}/baseTable/STAD_Info.addBurden.MSI_MSS.addCNVType.rmMIX.tsv \
--out_path ${work_dir}/finalPlot/revise/age

## logsitic回归调整年龄验证文章主要结论，比较不同分子亚型中IGC和DGC的突变负荷，以及不同分子亚型IM中饮酒对突变负荷的影响
${Rscript} ${scripts_path}/revise/age_tmb_logistic.R \
--info_file ${work_dir}/baseTable/STAD_Info.addBurden.MSI_MSS.addCNVType.rmMIX.tsv \
--public_file ${work_dir}/public_ref/combine/MutationInfo.combine.addMolecularSubType.rmMIX.tsv \
--images_path ${work_dir}/finalPlot/revise/age/logistic

## 中位年龄为66岁
# IGC和DGC比较突变负荷，按照年龄分层比较
${Rscript} ${scripts_path}/revise/age_mutBurden.MolecularType.R \
--input_file ${work_dir}/public_ref/combine/MutationInfo.combine.addMolecularSubType.rmMIX.tsv \
--out_path ${work_dir}/finalPlot/revise/age

# 按照年龄分层，分别IM不同分子亚型突变负荷
# mutBurden.IM.TCGA_Type.GS_CIN_MSI.All.Younger.pdf
# mutBurden.IM.TCGA_Type.GS_CIN_MSI.All.Older.pdf
${Rscript} ${scripts_path}/revise/age_mutBurden_plot.IM_MolecularType.R \
--info_file ${baseTable_path}/STAD_Info.addBurden.MSI_MSS.addCNVType.rmMIX.tsv \
--images_path ${work_dir}/finalPlot/revise/age

# 在不同分子亚型的IM中，比较年轻组和年老组的突变负荷差异,# 分年轻组和年老组，比较饮酒对突变负荷的
# mutBurden.Age_divide.cds.IM.MolType.pdf,mutBurden.Age_divide.cds.IM.MolType.Older.pdf,mutBurden.Age_divide.cds.IM.MolType.Younger.pdf
${Rscript} ${scripts_path}/mutBurden/mutBurden_plot.Baseline.R \
--input_file ${baseTable_path}/STAD_Info.addBurden.MSI_MSS.addCNVType.rmMIX.tsv \
--images_path ${work_dir}/finalPlot/revise/age/baseline

# 不同年龄组，比较突变率的差异
# 驱动基因整体突变数目的差异
${Rscript} ${scripts_path}/revise/age_mutRate_compute.R \
--maf_cancer_file ${maf_public_path}/All_use.maf \
--maf_im_file ${maf_public_path}/All_use.IM.maf \
--images_path ${work_dir}/finalPlot/revise/age/gene \
--info_file ${work_dir}/public_ref/combine/MutationInfo.combine.addMolecularSubType.rmMIX.tsv
# 可视化
${Rscript} ${scripts_path}/revise/age_mutRate_plot.R \
--mut_rate_gene_file ${work_dir}/finalPlot/revise/age/gene/MutRate.Age_divide.tsv \
--smg_file ${mutsig_check_path}/All_driver.list \
--images_path ${work_dir}/finalPlot/revise/age/gene



####################################################################################
## 突变信号采用SignatureEstimation直接映射到COSMIC
${Rscript} ${scripts_path}/revise/mutsignature_SignatureEstimation.R \
--maf_cancer_mss_file ${maf_public_path}/All_use.maf \
--maf_cancer_msi_file ${maf_public_path}/All_use.msi.maf \
--maf_im_mss_file ${maf_public_path}/All_use.IM.maf \
--maf_im_msi_file ${maf_public_path}/All_use.IM.msi.maf \
--info_file ${work_dir}/public_ref/combine/MutationInfo.combine.addMolecularSubType.rmMIX.tsv \
--cosmic_sig_file ~/ref/MutationSignature/COSMIC_v3.4_SBS_GRCh37.txt \
--out_path ${work_dir}/finalPlot/revise/signature

####################################################################################
## 整理预后信息
${Rscript} ${scripts_path}/revise/baseline_addsurvival.R \
--input_file ${work_dir}/public_ref/combine/MutationInfo.combine.addMolecularSubType.rmMIX.tsv \
--njmu_info_file ${config_path}/STAD_MutipleReigon_baseline.addAlcoholFreq.tsv \
--tcga_info_file ${work_dir}/public_ref/TCGA/stad_tcga_pan_can_atlas_2018_clinical_data.tsv \
--tmucih_info_file ${work_dir}/public_ref/TMUCIH/egc_tmucih_2015_clinical_data.tsv \
--out_file ${work_dir}/public_ref/combine/MutationInfo.combine.addMolecularSubType.rmMIX.addsurv.tsv

####################################################################################
#### focal CNV其在CIN亚型的IGC和DGC的差异，同时鉴定哪些基因落在这些区域，其是否与表达相关

#########################################
#### NJMU
## 对IGC和DGC分别跑gistic
# 创建合适的Combine_CIN_sampleInfo.tsv
${Rscript} ${scripts_path}/revise/gistic2_mergeSampleInfo.R \
--info_sample_file ${config_path}/tumor_normal.class.list \
--info_patient_file ${work_dir}/public_ref/combine/MutationInfo.combine.addMolecularSubType.Race.tsv \
--out_path ${work_dir}/finalPlot/revise/copynumber

# IGC sample
igc_sample=`cat ${work_dir}/finalPlot/revise/copynumber/Combine_CIN_sampleInfo.tsv  | grep -v Normal | grep -w IGC | awk -F'\t' '{print $3"_"$2}' | \
tr '\n' '|' | sed 's/|$//'`
# DGC sample
dgc_sample=`cat ${work_dir}/finalPlot/revise/copynumber/Combine_CIN_sampleInfo.tsv  | grep -v Normal | grep -w DGC | awk -F'\t' '{print $3"_"$2}' | \
tr '\n' '|' | sed 's/|$//'`
cat ${Titan_path}/gistci2.input.tsv | grep -w -E "Chromosome|${igc_sample}" > ${Titan_path}/gistci2_CIN_IGC_multi.input.tsv
cat ${Titan_path}/gistci2.input.tsv | grep -w -E "Chromosome|${dgc_sample}" > ${Titan_path}/gistci2_CIN_DGC_multi.input.tsv

## 运行gistic2
basedir_1=${work_dir}/finalPlot/revise/copynumber/gistic2/CIN_IGC_multi
basedir_2=${work_dir}/finalPlot/revise/copynumber/gistic2/CIN_DGC_multi
mkdir -p ${basedir_1}
mkdir -p ${basedir_2}
segfile_1=${Titan_path}/gistci2_CIN_IGC_multi.input.tsv
segfile_2=${Titan_path}/gistci2_CIN_DGC_multi.input.tsv
refgenefile=${GISTIC}/refgenefiles/hg19.mat

udocker run -e mcr_root=/opt/GISTIC/MATLAB_Compiler_Runtime/v83 \
-e BLAS_VERSION=/opt/GISTIC/MATLAB_Compiler_Runtime/v83/bin/glnxa64/mkl.so \
-e LAPACK_VERSION=/opt/GISTIC/MATLAB_Compiler_Runtime/v83/bin/glnxa64/mkl.so \
-v /public/:/public/ gistic -b $basedir_1 -seg $segfile_1 -refgene $refgenefile \
-genegistic 1 -smallmem 1 -broad 1 -brlen 0.5 -conf 0.99 -armpeel 1 -savegene 1 -gcm extreme

udocker run -e mcr_root=/opt/GISTIC/MATLAB_Compiler_Runtime/v83 \
-e BLAS_VERSION=/opt/GISTIC/MATLAB_Compiler_Runtime/v83/bin/glnxa64/mkl.so \
-e LAPACK_VERSION=/opt/GISTIC/MATLAB_Compiler_Runtime/v83/bin/glnxa64/mkl.so \
-v /public/:/public/ gistic -b $basedir_2 -seg $segfile_2 -refgene $refgenefile \
-genegistic 1 -smallmem 1 -broad 1 -brlen 0.5 -conf 0.99 -armpeel 1 -savegene 1 -gcm extreme

#########################################
## TCGA的的CIN亚型的IGC和DGC运行Gistic2
# IGC sample
igc_sample=`cat ${work_dir}/public_ref/combine/MutationInfo.combine.addMolecularSubType.Race.tsv | grep -v Tumor | grep -w IGC | grep -w TCGA | grep -w CIN | awk -F'\t' '{print $1}' | \
tr '\n' '|' | sed 's/|$//'`
# DGC sample
dgc_sample=`cat ${work_dir}/public_ref/combine/MutationInfo.combine.addMolecularSubType.Race.tsv  | grep -v Tumor | grep -w DGC | grep -w TCGA | grep -w CIN | awk -F'\t' '{print $1}' | \
tr '\n' '|' | sed 's/|$//'`

echo -e "Sample\tChromosome\tStart Position\tEnd Position\tNum markers\tSeg.CN" \
> ${work_dir}/seg_public/gistci2_TCGA.input.tsv
cat ${work_dir}/seg_public/TCGA_use.seg | grep -v "Sample" |\
awk -F'\t' '{OFS="\t"}{print $1,$2,$3,$4,$5,$6}' |\
awk -F"\t" '{if($2!~"23") print}' \
>> ${work_dir}/seg_public/gistci2_TCGA.input.tsv
cat ${work_dir}/seg_public/gistci2_TCGA.input.tsv | grep -w -E "Chromosome|${igc_sample}" > ${work_dir}/seg_public/gistci2_CIN_IGC_TCGA.input.tsv
cat ${work_dir}/seg_public/gistci2_TCGA.input.tsv | grep -w -E "Chromosome|${dgc_sample}" > ${work_dir}/seg_public/gistci2_CIN_DGC_TCGA.input.tsv

## 运行gistic2
basedir_1=${work_dir}/finalPlot/revise/copynumber/gistic2/CIN_IGC_TCGA
basedir_2=${work_dir}/finalPlot/revise/copynumber/gistic2/CIN_DGC_TCGA

mkdir -p ${basedir_1}
mkdir -p ${basedir_2}
segfile_1=${work_dir}/seg_public/gistci2_CIN_IGC_TCGA.input.tsv
segfile_2=${work_dir}/seg_public/gistci2_CIN_DGC_TCGA.input.tsv
refgenefile=${GISTIC}/refgenefiles/hg19.mat

udocker run -e mcr_root=/opt/GISTIC/MATLAB_Compiler_Runtime/v83 \
-e BLAS_VERSION=/opt/GISTIC/MATLAB_Compiler_Runtime/v83/bin/glnxa64/mkl.so \
-e LAPACK_VERSION=/opt/GISTIC/MATLAB_Compiler_Runtime/v83/bin/glnxa64/mkl.so \
-v /public/:/public/ gistic -b $basedir_1 -seg $segfile_1 -refgene $refgenefile \
-genegistic 1 -smallmem 1 -broad 1 -brlen 0.5 -conf 0.99 -armpeel 1 -savegene 1 -gcm extreme

udocker run -e mcr_root=/opt/GISTIC/MATLAB_Compiler_Runtime/v83 \
-e BLAS_VERSION=/opt/GISTIC/MATLAB_Compiler_Runtime/v83/bin/glnxa64/mkl.so \
-e LAPACK_VERSION=/opt/GISTIC/MATLAB_Compiler_Runtime/v83/bin/glnxa64/mkl.so \
-v /public/:/public/ gistic -b $basedir_2 -seg $segfile_2 -refgene $refgenefile \
-genegistic 1 -smallmem 1 -broad 1 -brlen 0.5 -conf 0.99 -armpeel 1 -savegene 1 -gcm extreme

#########################################
## TCGA和多病变的合并的CIN亚型的IGC和DGC运行Gistic2
cp ${Titan_path}/gistci2_CIN_IGC_multi.input.tsv ${work_dir}/finalPlot/revise/copynumber/gistci2_CIN_IGC_merge.input.tsv 
cp ${Titan_path}/gistci2_CIN_DGC_multi.input.tsv ${work_dir}/finalPlot/revise/copynumber/gistci2_CIN_DGC_merge.input.tsv
cat ${work_dir}/seg_public/gistci2_CIN_IGC_TCGA.input.tsv | grep -v "Sample" |\
awk -F'\t' '{OFS="\t"}{print $1,$2,$3,$4,$5,$6}' |\
awk -F"\t" '{if($2!~"23") print}' \
>> ${work_dir}/finalPlot/revise/copynumber/gistci2_CIN_IGC_merge.input.tsv
cat ${work_dir}/seg_public/gistci2_CIN_DGC_TCGA.input.tsv | grep -v "Sample" |\
awk -F'\t' '{OFS="\t"}{print $1,$2,$3,$4,$5,$6}' |\
awk -F"\t" '{if($2!~"23") print}' \
>> ${work_dir}/finalPlot/revise/copynumber/gistci2_CIN_DGC_merge.input.tsv

## 运行gistic2
basedir_1=${work_dir}/finalPlot/revise/copynumber/gistic2/CIN_IGC_merge
basedir_2=${work_dir}/finalPlot/revise/copynumber/gistic2/CIN_DGC_merge
mkdir -p ${basedir_1}
mkdir -p ${basedir_2}
segfile_1=${work_dir}/finalPlot/revise/copynumber/gistci2_CIN_IGC_merge.input.tsv
segfile_2=${work_dir}/finalPlot/revise/copynumber/gistci2_CIN_DGC_merge.input.tsv
refgenefile=${GISTIC}/refgenefiles/hg19.mat

udocker run -e mcr_root=/opt/GISTIC/MATLAB_Compiler_Runtime/v83 \
-e BLAS_VERSION=/opt/GISTIC/MATLAB_Compiler_Runtime/v83/bin/glnxa64/mkl.so \
-e LAPACK_VERSION=/opt/GISTIC/MATLAB_Compiler_Runtime/v83/bin/glnxa64/mkl.so \
-v /public/:/public/ gistic -b $basedir_1 -seg $segfile_1 -refgene $refgenefile \
-genegistic 1 -smallmem 1 -broad 1 -brlen 0.5 -conf 0.99 -armpeel 1 -savegene 1 -gcm extreme

udocker run -e mcr_root=/opt/GISTIC/MATLAB_Compiler_Runtime/v83 \
-e BLAS_VERSION=/opt/GISTIC/MATLAB_Compiler_Runtime/v83/bin/glnxa64/mkl.so \
-e LAPACK_VERSION=/opt/GISTIC/MATLAB_Compiler_Runtime/v83/bin/glnxa64/mkl.so \
-v /public/:/public/ gistic -b $basedir_2 -seg $segfile_2 -refgene $refgenefile \
-genegistic 1 -smallmem 1 -broad 1 -brlen 0.5 -conf 0.99 -armpeel 1 -savegene 1 -gcm extreme


<<EOF
#########################################
## 分IGC和DGC比较，focal的CNV存在的差异涉及哪些基因
## 针对已报道的驱动基因
class_list=(multi TCGA merge)
for class in ${class_list[@]}
do
## 得到输入
${Rscript} ${scripts_path}/revise/gistic2_trantobed.R \
--gistic_igc_file ${work_dir}/finalPlot/revise/copynumber/gistic2/CIN_IGC_${class}/scores.gistic \
--gistic_dgc_file ${work_dir}/finalPlot/revise/copynumber/gistic2/CIN_DGC_${class}/scores.gistic \
--out_path ${work_dir}/finalPlot/revise/copynumber/SCNA_unpaired/${class}

## 注释是否为已报道的胃癌及范癌的CNV驱动基因
type_list=(IGC DGC)
for type in ${type_list[@]}
do
${bedtools} intersect \
-a ${work_dir}/public_ref/SCNA_driver/SCNA_driver_STAD_GENCODE.V19.bed \
-b ${work_dir}/finalPlot/revise/copynumber/SCNA_unpaired/${class}/CIN_${type}_seg.bed \
-wa -wb \
> ${work_dir}/finalPlot/revise/copynumber/SCNA_unpaired/${class}/CIN_${type}_gene_score.bed
done

## 对COSMIC鉴定的扩增基因以及TCGA的显著的peak上的基因(关注的区域)，进行合并得到整合的GSCROE和Q
cnv_type_list=(Amplification Deletion)
type_list=(IGC DGC)
for type in ${type_list[@]}
do
echo ${type}
for cnv_type in ${cnv_type_list[@]}
do
echo ${cnv_type}
${Rscript} ${scripts_path}/revise/gistic2_combineSeg.R \
--report_gene_file ${work_dir}/public_ref/SCNA_driver/SCNA_driver_STAD_GENCODE.V19.bed \
--score_file ${work_dir}/finalPlot/revise/copynumber/SCNA_unpaired/${class}/CIN_${type}_gene_score.bed \
--bed_file ${work_dir}/finalPlot/revise/copynumber/SCNA_unpaired/${class}/CIN_${type}_seg.bed \
--cnv_type ${cnv_type} \
--type ${type} \
--out_path ${work_dir}/finalPlot/revise/copynumber/SCNA_unpaired/${class}
done
done
done

## 画图,类似于火山图
## 柱状图比较基因在AFP阳性和阴性的拷贝数扩增和丢失的占比
class_list=(multi TCGA merge)
for class in ${class_list[@]}
do
cnv_type_list=(Amplification Deletion)
for cnv_type in ${cnv_type_list[@]}
do
echo ${cnv_type}
${Rscript} ${scripts_path}/revise/gistic2_plot.R \
--score1_file ${work_dir}/finalPlot/revise/copynumber/SCNA_unpaired/${class}/CIN_IGC_${cnv_type}.Driver_Gscore.csv \
--score2_file ${work_dir}/finalPlot/revise/copynumber/SCNA_unpaired/${class}/CIN_DGC_${cnv_type}.Driver_Gscore.csv \
--info_multi_file ${work_dir}/finalPlot/revise/copynumber/Combine_CIN_sampleInfo.tsv \
--info_TCGA_file ${work_dir}/public_ref/combine/MutationInfo.combine.addMolecularSubType.Race.tsv \
--type ${class} \
--gene1_file ${work_dir}/finalPlot/revise/copynumber/gistic2/CIN_IGC_${class}/all_data_by_genes.txt \
--gene2_file ${work_dir}/finalPlot/revise/copynumber/gistic2/CIN_DGC_${class}/all_data_by_genes.txt \
--cgen_file ${work_dir}/public_ref/SCNA_driver/SCNA_driver_STAD_${cnv_type}_candidate_Gene.csv \
--cnv_type ${cnv_type} \
--out_path ${work_dir}/finalPlot/revise/copynumber/SCNA_unpaired/${class}
done
done
EOF

#########################################
## 在CIN中分IGC和DGC比较，focal的CNV存在的差异，涉及哪些基因，是否和表达相关

class_list=(multi TCGA merge)
for class in ${class_list[@]}
do

## 对CIN的IGC和DGC进行Gene级别的比较(先比较Cytoband 的差异，然后再比较Gene的差异)
## 扩增+缺失
${Rscript_clusterProfiler} ${scripts_path}/revise/gistic2_GeneLevel_compare_cnv_plot.R \
--gisticAllLesionsFile_IGC ${work_dir}/finalPlot/revise/copynumber/gistic2/CIN_IGC_${class}/all_lesions.conf_99.txt \
--gisticAmpGenesFile_IGC ${work_dir}/finalPlot/revise/copynumber/gistic2/CIN_IGC_${class}/amp_genes.conf_99.txt \
--gisticDelGenesFile_IGC ${work_dir}/finalPlot/revise/copynumber/gistic2/CIN_IGC_${class}/del_genes.conf_99.txt \
--gisticScoresFile_IGC ${work_dir}/finalPlot/revise/copynumber/gistic2/CIN_IGC_${class}/scores.gistic \
--gisticAllLesionsFile_DGC ${work_dir}/finalPlot/revise/copynumber/gistic2/CIN_DGC_${class}/all_lesions.conf_99.txt \
--gisticAmpGenesFile_DGC ${work_dir}/finalPlot/revise/copynumber/gistic2/CIN_DGC_${class}/amp_genes.conf_99.txt \
--gisticDelGenesFile_DGC ${work_dir}/finalPlot/revise/copynumber/gistic2/CIN_DGC_${class}/del_genes.conf_99.txt \
--gisticScoresFile_DGC ${work_dir}/finalPlot/revise/copynumber/gistic2/CIN_DGC_${class}/scores.gistic \
--all_data_by_genes_IGC ${work_dir}/finalPlot/revise/copynumber/gistic2/CIN_IGC_${class}/all_data_by_genes.txt \
--all_data_by_genes_DGC ${work_dir}/finalPlot/revise/copynumber/gistic2/CIN_DGC_${class}/all_data_by_genes.txt \
--dat_info_multi ${work_dir}/finalPlot/revise/copynumber/Combine_CIN_sampleInfo.tsv \
--dat_info_TCGA ${work_dir}/public_ref/combine/MutationInfo.combine.addMolecularSubType.Race.tsv \
--out_path ${work_dir}/finalPlot/revise/copynumber/CNA \
--geneprotein_list ~/ref/GTF/gencode.v19.geneprotein_coding.gtf \
--Class ${class}

## 对CIN的IGC和DGC进行focal级别的比较(展示IGC中显著高的)
## 扩增+缺失
# gscore
${Rscript_clusterProfiler} ${scripts_path}/revise/gistic2_FocalLevel_compare_cnv_plot_score.R \
--gisticAllLesionsFile_IGC ${work_dir}/finalPlot/revise/copynumber/gistic2/CIN_IGC_${class}/all_lesions.conf_99.txt \
--gisticAmpGenesFile_IGC ${work_dir}/finalPlot/revise/copynumber/gistic2/CIN_IGC_${class}/amp_genes.conf_99.txt \
--gisticDelGenesFile_IGC ${work_dir}/finalPlot/revise/copynumber/gistic2/CIN_IGC_${class}/del_genes.conf_99.txt \
--gisticScoresFile_IGC ${work_dir}/finalPlot/revise/copynumber/gistic2/CIN_IGC_${class}/scores.gistic \
--gisticAllLesionsFile_DGC ${work_dir}/finalPlot/revise/copynumber/gistic2/CIN_DGC_${class}/all_lesions.conf_99.txt \
--gisticAmpGenesFile_DGC ${work_dir}/finalPlot/revise/copynumber/gistic2/CIN_DGC_${class}/amp_genes.conf_99.txt \
--gisticDelGenesFile_DGC ${work_dir}/finalPlot/revise/copynumber/gistic2/CIN_DGC_${class}/del_genes.conf_99.txt \
--gisticScoresFile_DGC ${work_dir}/finalPlot/revise/copynumber/gistic2/CIN_DGC_${class}/scores.gistic \
--show_Cytoband_amp_file ${work_dir}/finalPlot/revise/copynumber/CNA/amp/sig_gene_amp_merge.tsv  \
--show_Cytoband_del_file ${work_dir}/finalPlot/revise/copynumber/CNA/del/sig_gene_del_merge.tsv  \
--out_path ${work_dir}/finalPlot/revise/copynumber/CNA \
--Class ${class}
# qvalue
${Rscript_clusterProfiler} ${scripts_path}/revise/gistic2_FocalLevel_compare_cnv_plot_qvalue.R \
--gisticAllLesionsFile_IGC ${work_dir}/finalPlot/revise/copynumber/gistic2/CIN_IGC_${class}/all_lesions.conf_99.txt \
--gisticAmpGenesFile_IGC ${work_dir}/finalPlot/revise/copynumber/gistic2/CIN_IGC_${class}/amp_genes.conf_99.txt \
--gisticDelGenesFile_IGC ${work_dir}/finalPlot/revise/copynumber/gistic2/CIN_IGC_${class}/del_genes.conf_99.txt \
--gisticScoresFile_IGC ${work_dir}/finalPlot/revise/copynumber/gistic2/CIN_IGC_${class}/scores.gistic \
--gisticAllLesionsFile_DGC ${work_dir}/finalPlot/revise/copynumber/gistic2/CIN_DGC_${class}/all_lesions.conf_99.txt \
--gisticAmpGenesFile_DGC ${work_dir}/finalPlot/revise/copynumber/gistic2/CIN_DGC_${class}/amp_genes.conf_99.txt \
--gisticDelGenesFile_DGC ${work_dir}/finalPlot/revise/copynumber/gistic2/CIN_DGC_${class}/del_genes.conf_99.txt \
--gisticScoresFile_DGC ${work_dir}/finalPlot/revise/copynumber/gistic2/CIN_DGC_${class}/scores.gistic \
--show_Cytoband_amp_file ${work_dir}/finalPlot/revise/copynumber/CNA/amp/sig_gene_amp_merge.tsv  \
--show_Cytoband_del_file ${work_dir}/finalPlot/revise/copynumber/CNA/del/sig_gene_del_merge.tsv  \
--out_path ${work_dir}/finalPlot/revise/copynumber/CNA \
--Class ${class}

## 基因表达和CNV的相关性
## 扩增+缺失
${Rscript_clusterProfiler} ${scripts_path}/revise/gistic2_Cor_CNV_expression_plot.R \
--all_data_by_genes_IGC ${work_dir}/finalPlot/revise/copynumber/gistic2/CIN_IGC_${class}/all_data_by_genes.txt \
--all_data_by_genes_DGC ${work_dir}/finalPlot/revise/copynumber/gistic2/CIN_DGC_${class}/all_data_by_genes.txt \
--amp_gene ${work_dir}/finalPlot/revise/copynumber/CNA/amp/CIN_IGCcompareDGC_Driver.copy_number_amp_${class}.tsv \
--del_gene ${work_dir}/finalPlot/revise/copynumber/CNA/del/CIN_IGCcompareDGC_Driver.copy_number_del_${class}.tsv \
--express_file ${mRNA_path}/CombineTMM.DNAUse.NJMU_TCGA.MergeMutiSample.tsv \
--dat_info_multi ${work_dir}/finalPlot/revise/copynumber/Combine_CIN_sampleInfo.tsv \
--dat_info_TCGA ${work_dir}/public_ref/combine/MutationInfo.combine.addMolecularSubType.Race.tsv \
--out_path ${work_dir}/finalPlot/revise/copynumber/CNA/expression \
--Class ${class}
done


####################################################################################
## 增加预后的基线整理
${Rscript_mutationTime} ${scripts_path}/revise/CompareBaseLine.CombinePublic.addsurvival.R \
--input_file ${work_dir}/public_ref/combine/MutationInfo.combine.addMolecularSubType.rmMIX.addsurv.tsv \
--out_dir ${work_dir}/finalPlot/revise/survival

## 计算SMG对预后的影响
${Rscript} ${scripts_path}/revise/survival_forSMG.R \
--info_file ${work_dir}/public_ref/combine/MutationInfo.combine.addMolecularSubType.rmMIX.addsurv.tsv \
--dat_maf_file ${work_dir}/maf_public/All_use.maf \
--driver_list ${work_dir}/mutsig_check/All_driver.list \
--trunk_list ${work_dir}/finalPlot/evolutionTime/CompareTrunkSMG.Time.tsv \
--out_path ${work_dir}/finalPlot/revise/survival
